import request from '../utils/request';

// 合同人员管理相关API
export const contractPersonnelApi = {
  // 获取合同人员列表
  getContractPersonnelList: (params) => {
    return request.get('/api/contract-personnel/page', { params });
  },

  // 获取合同人员详情
  getContractPersonnelDetail: (id) => {
    return request.get(`/api/contract-personnel/${id}`);
  },

  // 创建合同人员
  createContractPersonnel: (data) => {
    return request.post('/api/contract-personnel', data);
  },

  // 更新合同人员
  updateContractPersonnel: (id, data) => {
    return request.put(`/api/contract-personnel/${id}`, data);
  },

  // 删除合同人员
  deleteContractPersonnel: (id) => {
    return request.delete(`/api/contract-personnel/${id}`);
  },

  // 根据合同ID获取人员列表
  getPersonnelByContract: (contractId) => {
    return request.get(`/api/contract-personnel/contract/${contractId}`);
  },

  // 批量创建合同人员
  batchCreateContractPersonnel: (data) => {
    return request.post('/api/contract-personnel/batch', data);
  },

  // 根据项目编号获取合同人员列表
  getPersonnelByProjectCode: (projectCode) => {
    return request.get(`/api/contract-personnel/project/${projectCode}`);
  }
};

// 项目成员卡片相关API
export const projectMemberCardApi = {
  // 获取项目成员卡片列表
  getProjectMemberCards: () => {
    return request.get('/api/project-member-cards');
  },

  // 根据状态获取项目成员卡片列表
  getProjectMemberCardsByStatus: (hasInactiveMembers = false) => {
    return request.get('/api/project-member-cards/status', { 
      params: { hasInactiveMembers } 
    });
  },

  // 根据客户ID获取项目成员卡片列表
  getProjectMemberCardsByCustomer: (customerId) => {
    return request.get(`/api/project-member-cards/customer/${customerId}`);
  },

  // 根据签约公司ID获取项目成员卡片列表
  getProjectMemberCardsByContractCompany: (contractCompanyId) => {
    return request.get(`/api/project-member-cards/contract-company/${contractCompanyId}`);
  }
};
